package engine.collider.bounds;

import engine.collider.CollisionDetector;
import engine.collider.ContactPoint;

public class BoundingSphere extends BoundingElement {
	private double radius;

	public double getRadius() {
		return radius;
	}

	public void setRadius(double radius) {
		this.radius = radius;
	}
	
	public void setPosX(double x) {
		getPosition()[0] = x;
	}
	
	public void setPosY(double y) {
		getPosition()[1] = y;
	}
	
	public void setPosZ(double z) {
		getPosition()[2] = z;
	}
	
	public double getPosX() {
		return getPosition()[0];
	}
	
	public double getPosY() {
		return getPosition()[1];
	}
	
	public double getPosZ() {
		return getPosition()[2];
	}
	
	@Override
	public ContactPoint collide(double[] pos, double[] vec,
			BoundingElement collidingElement, double[] colliderPos,
			double[] colliderVec) {
		
		if(collidingElement instanceof BoundingSphere) {
			BoundingSphere s = (BoundingSphere)collidingElement;
			
			return CollisionDetector.sphereSphereCollision(this, pos, vec, s, colliderPos, colliderVec);
		}
		
		return null;
	}
}
